<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
echo "<h2>Вопрос-ответ</h2>";
$this->table->set_heading('id', 'Имя', 'Тема', 'Дата', 'Статус', 'Действия');
$tmpl = array('table_open' => '<table border="0" cellpadding="0" cellspacing="0" class="admin_table">');
$this->table->set_template($tmpl);

$parents[0] = "Новое";
$parents[1] = "Обработано";
$parents[2] = "Отказано";

$class = 'faq';
if ($this->users_rights_model->check_rights($class, 'block', true)) $canblock = 1;
if ($this->users_rights_model->check_rights($class, 'unblock', true)) $canblock = 1;
if ($this->users_rights_model->check_rights($class, 'edit', true)) $canedit = 1;
if ($this->users_rights_model->check_rights($class, 'delete', true)) $candelete = 1;
if ($this->users_rights_model->check_rights($class, 'add', true)) $canadd = 1;
?>
	<div class="filter">
		<a href="/admin/<?=$class?>/?from=<?=$from?>" <?=($this->input->get('status') === false?"class='active'":"")?>>Все</a>
		<a href="/admin/<?=$class?>/?from=<?=$from?>&status=0" <?=($this->input->get('status') === "0"?"class='active'":"")?>>Только новые</a>
		<a href="/admin/<?=$class?>/?from=<?=$from?>&status=1" <?=($this->input->get('status') == 1?"class='active'":"")?>>Только обработанные</a>
		<a href="/admin/<?=$class?>/?from=<?=$from?>&status=2" <?=($this->input->get('status') == 2?"class='active'":"")?>>Только отказанные</a>
	</div>
<?
foreach ($pages as $page) {
	$this->table->add_row(
			$page['faq_id'],
			"<a href='/admin/faq/show/".$page['faq_id']."/'>".$page['faq_name']."</a>",
			$page['faq_title'],
			showmedate($page['faq_date']),
			$parents[$page['faq_status']],
			showmeactions(
					$class,
					$page['faq_id'],
					$page['faq_status'],
					0, $candelete, 0,
					$from
				)
		);
}
echo $this->table->generate();
echo $paging;
echo "<div class='cc'></div>";
?>
